﻿
Partial Class Apps_report_staff
    Inherits System.Web.UI.Page

    Protected Sub btnFilter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFilter.Click

        Try

            Dim lstDepString As String = ""
            Dim i As Integer
            Dim subString As String = ""

            For i = 0 To lstStpDepartment.Items.Count - 1
                If lstStpDepartment.Items(i).Selected Then
                    lstDepString += lstStpDepartment.Items(i).Value + ","
                End If
            Next

            If lstDepString = "" Then
                subString = "0"
            Else
                subString = lstDepString.Substring(0, lstDepString.Length - 1)
            End If

            Dim url = "../Reports/report_staff2.aspx?department_code={0}&staff_status={1}"
            url = String.Format(url, _
                                subString, _
                                ddlStatus.SelectedValue)

            Dim script = String.Format(" window.open('{0}','_blank');", url)

            ScriptManager.RegisterStartupScript( _
            Me, _
            Me.GetType(), _
            Guid.NewGuid().ToString(), _
            script, _
            True _
            )
        Catch ex As Exception
            GenericHelper.ShowAlert(Me, ex.Message)
        End Try

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        lstStpDepartment.Items.Item(0).Value = 0
        lstStpDepartment.Items.Item(0).Text = "ทั้งหมด"
    End Sub

    Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
        Dim BreadCrumpBG As HtmlControl = Page.Master.FindControl("tdBreadCrump")
        Dim BreadCrump As Literal = Page.Master.FindControl("ltrBreadCrump")
        CodeMatrix.Business.GenericData.SetBreadCrump(BreadCrumpBG, BreadCrump, 48)
    End Sub
End Class
